package 补充.输入输出操作.字节流;

import java.io.*;

public class 字节缓冲流复制文件 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("D:\\Learn\\javademo\\untitled\\src\\补充_偏\\输入输出操作\\read.txt");
        FileOutputStream fos =new FileOutputStream("D:\\Learn\\javademo\\untitled\\tar\\read.txt");
        BufferedInputStream bis = new BufferedInputStream(fis);
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        int len;
        long begin = System.currentTimeMillis();
        while ((len=bis.read())!=-1){
            bos.write(len);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制文件耗时"+(end - begin));
        bos.close();
        fis.close();
        fos.close();
        bis.close();
    }
}
